<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            width: 700px;
            height: 50px;
            margin: 200px auto;
            border: 2px solid skyblue;
            border-radius: 30px;
            /* background: linear-gradient(to right, rgb(2, 255, 150) 0%, rgb(5, 240, 100) 0%); */
        }

        #box1 {
            height: 50px;
            border-radius: 30px;
        }
    </style>
</head>

<body>
    <div id="box">
        <div id="box1"></div>
        <span>0%</span>
    </div>
    <script>
        var box = document.getElementById('box')
        var perent = 0
        var hang = document.getElementsByTagName('span')
        var timer = setInterval(function () {
            perent++
            box.style.background = 'linear-gradient(to right, skyblue ' + perent + '%, pink 0%)'

            hang[0].innerHTML = perent + '%'
            if (perent === 100) {
                clearInterval(timer)
            }
        }, 500)
    </script>
</body>

</html>